﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Root.Master" AutoEventWireup="true"
    CodeBehind="Login.aspx.cs" Inherits="OpenPhotoAlbum.Login" %>
<%@ Register Assembly="OpenPhotoAlbum" Namespace="OpenPhotoAlbum.Controls" TagPrefix="cc" %>

<asp:Content ID="Content2" ContentPlaceHolderID="phContent" runat="server">
    <div class="login">
		<div class="welcome"><%= Resources.Strings.Login_Welcome %></div>
        <cc:TabPanels ID="tabPanels" CssClass="tabPanels" runat="server" />
        <cc:TabPanel ID="pnlLogin" runat="server">
            <div class="input">
                <table align="center">
                    <tr>
                        <td class="leftColumn"><asp:Literal ID="ltrUserName" runat="server" /></td>
                        <td class="rightColumn"><asp:TextBox ID="tbUserName" runat="server" CssClass="inputBox" /></td>
                    </tr>
                    <tr>
                        <td class="leftColumn"><asp:Literal ID="ltrPassword" runat="server" /></td>
                        <td class="rightColumn"><asp:TextBox ID="tbPassword" runat="server" TextMode="Password" CssClass="inputBox" /></td>
                    </tr>
                    <tr>
                        <td class="leftColumn"></td>
                        <td class="rightColumn"><asp:CheckBox ID="cbRememberMe" runat="server" Checked="false" /></td>
                    </tr>
                    <tr>
                        <td class="leftColumn"></td>
                        <td class="rightColumn"><asp:Button ID="btnLogin" runat="server" OnClick="btnLogin_Click" /></td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center"><div class="error"><cc:Message ID="msgError" runat="server" /></div></td>
                    </tr>
                    <tr>
						<td class="leftColumn"></td>
                        <td class="rightColumn">&gt; <asp:HyperLink ID="hlJoin" runat="server" Target="_self"></asp:HyperLink></td>
                    </tr>
                </table>
            </div>
        </cc:TabPanel>
        <cc:TabPanel ID="pnlRecovery" runat="server" CssClass="recovery">
			<table>
				<tr><td align="right"><asp:Literal ID="ltrUserName2" runat="server" /></td><td align="left"><asp:TextBox ID="tbUserName2" runat="server" /></td></tr>
				<tr><td align="right"><asp:Literal ID="ltrEmail" runat="server" /></td><td align="left"><asp:TextBox ID="tbEmail" runat="server" /></td></tr>
				<tr><td></td><td align="left"><input id="btnSendProxy" type="button" value="<%= Resources.Strings.Send %>" /><asp:Button ID="btnSend" runat="server" style="display:none;" /></td></tr>
			</table>
			<div><cc:Message ID="message" runat="server" /></div>
        </cc:TabPanel>
    </div>
    <script type="text/javascript">
    	var focusTextBox$Delegate = Function.createDelegate(this, focusTextBox);
    	Sys.Application.add_load(focusTextBox$Delegate);
    	function focusTextBox() {
    		Sys.Application.remove_load(focusTextBox$Delegate);
    		if ($get('<%= pnlLogin.ClientID %>').style.display == 'none') { return; }
    		$get('<%= tbUserName.ClientID %>').focus();
    	}
//    	var tbPassword = $get('<%= tbPassword.ClientID %>');
//    	$addHandler(tbPassword, 'keydown', onKeyDownPassword);
//    	function onKeyDownPassword(e) {
//    		if (e.keyCode == 13) {
//    			var btn = $get('<%= btnLogin.ClientID %>');
//    			btn.focus();
//    			btn.click();
//    		}
//    	}
    	var tbEmail = $get('<%= tbEmail.ClientID %>');
    	$addHandler(tbEmail, 'keydown', onKeyDownEmail);
    	function onKeyDownEmail(e) {
    		if (e.keyCode == 13) {
    			var btn = $get('btnSendProxy');
    			btn.focus();
    			btn.click();
    		}
    	}
    	var btnSendProxy = $get('btnSendProxy');
    	$addHandler(btnSendProxy, 'click', onClick);
    	function onClick() {
    		var btn = $get('btnSendProxy');
    		btn.value = '<%= Resources.Strings.Sending %>';
    		btn.disabled = true;

    		$get('<%= btnSend.ClientID %>').click();
    		
    	}
    	function resetBtn() {
    		var btn = $get('btnSendProxy');
    		btn.value = '<%= Resources.Strings.Send %>';
    		btn.disabled = false;
    	}
    </script>
</asp:Content>
